package com.yonyou.cyxdms.sysAuth.service.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.yonyou.cyxdms.framework.bean.entity.base.DMSBasePO;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.baomidou.mybatisplus.annotation.Version;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableField;

import java.io.Serializable;
import com.yonyou.cyx.function.utils.bean.BeanMapperUtil;
import com.baomidou.mybatisplus.annotation.TableField;
import com.yonyou.cyx.framework.bean.dto.base.BaseDTO;

/**
 * <p>
 * 组织关系表
 * </p>
 *
 * @author 李贺
 * @since 2019-09-18
 */
@TableName("tr_org")
public class TrOrgPO extends DMSBasePO<TrOrgPO> {

    private static final long serialVersionUID = 1L;

    /**
     * 组织关系ID
     */
        @TableId(value = "RELATION_ID", type = IdType.AUTO)
        private Long relationId;
    /**
     * 组织ID
     */
    @TableField("ORG_ID")
    private Long orgId;
    /**
     * 上级ID
     */
    @TableField("PARENT_ORG_ID")
    private Long parentOrgId;
    /**
     * 上端下发数据ID
     */
    @TableField("SOURCE_ID")
    private Long sourceId;
    /**
     * 上端下发数据日期
     */
    @TableField("SOURCE_CHANGED_AT")
    private LocalDateTime sourceChangedAt;
    @TableField("IS_DELETED")
    @Version
    @TableLogic
    private Integer isDeleted;

    public TrOrgPO() {
        super();
    }


    public Long getRelationId() {
        return relationId;
    }

    public void setRelationId(Long relationId) {
        this.relationId = relationId;
    }

    public Long getOrgId() {
        return orgId;
    }

    public void setOrgId(Long orgId) {
        this.orgId = orgId;
    }

    public Long getParentOrgId() {
        return parentOrgId;
    }

    public void setParentOrgId(Long parentOrgId) {
        this.parentOrgId = parentOrgId;
    }

    public Long getSourceId() {
        return sourceId;
    }

    public void setSourceId(Long sourceId) {
        this.sourceId = sourceId;
    }

    public LocalDateTime getSourceChangedAt() {
        return sourceChangedAt;
    }

    public void setSourceChangedAt(LocalDateTime sourceChangedAt) {
        this.sourceChangedAt = sourceChangedAt;
    }

    @Override
    public Integer getIsDeleted() {
        return isDeleted;
    }

    @Override
    public void setIsDeleted(Integer isDeleted) {
        this.isDeleted = isDeleted;
    }

    @Override
    protected Serializable pkVal() {
        return this.relationId;
    }

    @Override
    public String toString() {
        return "TrOrgPO{" +
        "relationId=" + relationId +
        ", orgId=" + orgId +
        ", parentOrgId=" + parentOrgId +
        ", sourceId=" + sourceId +
        ", sourceChangedAt=" + sourceChangedAt +
        ", isDeleted=" + isDeleted +
        "}";
    }


    /**
     * 将PO 信息转化为DTO
     *
     * @param dto 需要进行转换的dto
     * @author 李贺
     * @since 2018/7/22 0022
     */
    protected <T extends BaseDTO> void transDtoToPo(T dto) {
        BeanMapperUtil.copyProperties(this, dto, "relationId");
    }


}
